
package org.codebase.common.matcher;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MatcherIdNumber {
	public static void main(String[] args) {
		//String temp = "018082200006030098";
		String temp = "430522199009250011";
		String patternString = "(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$)";
		Pattern pattern = Pattern.compile(patternString);
		Matcher matcher = pattern.matcher(temp);
		while (matcher.find()) {
			System.out.println(matcher.group(0));
		}
	}
}
